import Vue from 'vue'

const axios = Vue.$axios

export const GetListMenu = (param) => {

    return new Promise((resolve, reject)=>{
        axios({
            url: '/menus',
            method: 'get',
            // params: param
        }).then(res=>{
            resolve(res)
        }).catch(err=>{
            reject(err)
        })
    })

}

export const GetOneMenu = (id) => {
    return axios({
        url: '/menus/' + id,
        method: 'get'
    })
}

export const CreateOneMenu = (data) => {
    return axios({
        url: '/menus',
        method: 'post',
        data: data
    })
}

export const UpdateOneMenu = (data) => {
    return axios({
        url: '/menus' + "/" + data.id,
        method: 'put',
        data: data
    })
}

export const RemoveOneMenu = (id) => {
    return axios({
        url: '/menus/' + id,
        method: 'delete',
    })
}

